import request from "@/utils/request";
import { type common_login_type, type User } from "@/types/CommonUser"
enum API {
    Common = "/commonUser"
}

export const common_login = (data: common_login_type) => request({
    method: "post",
    url: API.Common,
    data
})
export const common_list = (currentPage: number) => request({
    method: "get",
    url: API.Common + `/${currentPage}`,
})

export const common_update = (data: User) => request({
    method: "put",
    url: API.Common,
    data
})
export const common_delete = (_id: string) => request({
    method: "delete",
    url: API.Common,
    data: {
        _id: _id
    }
})

export const update_avatar = (data: { id: string, url: string }) => request({
    method: "post",
    url: API.Common + '/avatar',
    data
})